//
//  XHud.m
//  Hai
//
//  Created by 千金贷 on 16/4/27.
//  Copyright © 2016年 wangzijian. All rights reserved.
//

#import "XHud.h"

@interface XHud ()
@end
@implementation XHud

#pragma mark - hud状态改变

+ (MBProgressHUD *)createHUDInView:(UIView *)view
{
    MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:view];
    hud.labelFont = [UIFont systemFontOfSize:12.0f];
    [view addSubview:hud];
    
    return hud;
    
}

+ (MBProgressHUD *)createHUDInwindow
{
    MBProgressHUD *hud = [[MBProgressHUD alloc] initWithWindow:[UIApplication sharedApplication].keyWindow];
    hud.labelFont = [UIFont systemFontOfSize:12.0f];
    [[UIApplication sharedApplication].keyWindow addSubview:hud];
    
    return hud;
    
}
+ (void)showHud:(MBProgressHUD *)hud WithWaitigText:(NSString *)text
{
    hud.mode = MBProgressHUDModeIndeterminate;
    hud.labelText = text;
    hud.dimBackground = YES;
    
    [hud show:YES];
    
}

+ (void)showHud:(MBProgressHUD *)hud WithTipText:(NSString *)text
{
    hud.mode = MBProgressHUDModeText;
    hud.dimBackground = NO;
    
    hud.labelText = text;
    [hud show:YES];

    [hud hide:YES afterDelay:0.7];
}

@end
